package cn.mcartoon.serviceImpl;
import cn.mcartoon.mapper.MmSmsLogMapper;
import cn.mcartoon.pojo.MmSmsLog;
import cn.mcartoon.service.MmSmsLogService;
import cn.mcartoon.dto.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;
@Service
public class MmSmsLogServiceImpl implements MmSmsLogService {

    @Autowired
    private MmSmsLogMapper mmSmsLogMapper;

    public MmSmsLog getMmSmsLogById(Long id){
        return mmSmsLogMapper.getMmSmsLogById(id);
    }

    public List<MmSmsLog>	getMmSmsLogListByMap(Map<String,Object> param){
        return mmSmsLogMapper.getMmSmsLogListByMap(param);
    }

    public Integer getMmSmsLogCountByMap(Map<String,Object> param){
        return mmSmsLogMapper.getMmSmsLogCountByMap(param);
    }

    public Integer insertMmSmsLog(MmSmsLog mmSmsLog){
            return mmSmsLogMapper.insertMmSmsLog(mmSmsLog);
    }

    public Integer updateMmSmsLog(MmSmsLog mmSmsLog){
        return mmSmsLogMapper.updateMmSmsLog(mmSmsLog);
    }

    public Integer deleteMmSmsLogById(Long id){
        return mmSmsLogMapper.deleteMmSmsLogById(id);
    }

    public Integer batchDeleteMmSmsLog(String ids){
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return mmSmsLogMapper.batchDeleteMmSmsLog(param);
    }

    public Page<MmSmsLog> queryMmSmsLogPageByMap(Map<String,Object> param,Integer pageNo,Integer pageSize){
        Integer total = mmSmsLogMapper.getMmSmsLogCountByMap(param);
        Page page = new Page(pageNo, pageSize, total);
        param.put("beginPos", page.getBeginPos());
        param.put("pageSize", page.getPageSize());
        List<MmSmsLog> mmSmsLogList = mmSmsLogMapper.getMmSmsLogListByMap(param);
        page.setList(mmSmsLogList);
        return page;
     }


}
